<?php
// $Id: config_manage_4.php 229 2008-03-03 13:27:42Z mikhail.miguel $

// 2007-08-01 K.OHWADA
// divid google map to config_manage_6.php

// 2007-06-10 K.OHWADA
// d3forum

// 2007-03-25 K.OHWADA
// form_cat_album

// 2007-02-20 K.OHWADA
// hack for multi site
// renew config table

// 2006-11-03 K.OHWADA
// google map inline mode

// 2006-10-15 wye & K.OHWADA
// BUG 4313: same browser like opera cannot show gm_get_location.php

// 2006-10-05 K.OHWADA
// this is new file
// devid from index.php
// use rssc WEBLINKS_RSSC_EXIST

//=========================================================
// WebLinks Module
// 2006-10-05 K.OHWADA
//=========================================================

//---------------------------------------------------------
// TODO
// make function RSSC installed
//---------------------------------------------------------

include_once 'admin_header.php';
include_once XOOPS_ROOT_PATH.'/modules/happy_linux/class/config_base_handler.php';
include_once XOOPS_ROOT_PATH.'/modules/happy_linux/class/config_define_handler.php';
include_once XOOPS_ROOT_PATH.'/modules/happy_linux/class/config_store_handler.php';
include_once WEBLINKS_ROOT_PATH.'/include/weblinks_version.php';
include_once WEBLINKS_ROOT_PATH.'/class/weblinks_config2_handler.php';
include_once WEBLINKS_ROOT_PATH.'/class/weblinks_config2_define_handler.php';
include_once WEBLINKS_ROOT_PATH.'/class/weblinks_linkitem_handler.php';
include_once WEBLINKS_ROOT_PATH.'/class/weblinks_linkitem_define_handler.php';
include_once WEBLINKS_ROOT_PATH.'/class/weblinks_linkitem_store_handler.php';
include_once WEBLINKS_ROOT_PATH.'/class/weblinks_config_check_handler.php';
include_once WEBLINKS_ROOT_PATH.'/class/weblinks_link_form_handler.php';
include_once WEBLINKS_ROOT_PATH.'/admin/admin_config_class.php';

// class
$config_form  =& admin_config_form::getInstance();
$config_store =& admin_config_store::getInstance();
$link_form_handler =& weblinks_get_handler( 'link_form', WEBLINKS_DIRNAME );

$op = $config_form->get_post_get_op();

if ($op == 'save')
{
	if( !$config_form->check_token() ) 
	{
		xoops_cp_header();
		xoops_error("Token Error");
		echo "<br />\n";
		echo $config_form->get_token_error(1);
		echo "<br />\n";
	}
	else
	{
		$ret = $config_store->save_config();
		if ($ret)
		{
			redirect_header("config_manage_4.php", 1, _WLS_DBUPDATED);
		}
		else
		{
			xoops_cp_header();
			xoops_error("DB Error");
			echo $config_store->getErrors(1);
		}
	}
}
elseif ($op == 'renew')
{
	if( !$config_form->check_token() ) 
	{
		xoops_cp_header();
		xoops_error("Token Error");
		echo "<br />\n";
		echo $config_form->get_token_error(1);
		echo "<br />\n";
	}
	else
	{
		$ret = $config_store->renew_config();
		if ($ret)
		{
			redirect_header("config_manage_4.php", 1, _WLS_DBUPDATED);
		}
		else
		{
			xoops_cp_header();
			xoops_error("DB Error");
			echo $config_store->getErrors(1);
		}
	}
}
else
{
	xoops_cp_header();
}

$config_store->print_style_sheet();

weblinks_admin_print_header();
weblinks_admin_print_menu();
$config_form->print_menu_4();
echo "<br />\n";
$config_form->set_submit_value( _WEBLINKS_UPDATE );
$config_form->init_form();

echo '<a name="form_rss"></a>'."\n";
echo "<h4>"._WEBLINKS_ADMIN_RSS."</h4>\n";
$config_form->print_rssc_module_installed();
$config_form->show_by_catid( 15, _WEBLINKS_ADMIN_RSS );

echo '<a name="form_rss_view"></a>'."\n";
echo "<h4>"._WEBLINKS_ADMIN_RSS_VIEW."</h4>\n";
$config_form->show_by_catid( 16, _WEBLINKS_ADMIN_RSS_VIEW );

echo '<a name="form_cat_forum"></a>'."\n";
echo "<h4>"._AM_WEBLINKS_CONF_CAT_FORUM."</h4>\n";
$config_form->print_module_installed_by_conf( 'forum', 'cat_forum_dirname' );
$config_form->show_by_catid( 17, _AM_WEBLINKS_CONF_CAT_FORUM );

echo '<a name="form_link_forum"></a>'."\n";
echo "<h4>"._AM_WEBLINKS_CONF_LINK_FORUM."</h4>\n";
$config_form->print_module_installed_by_conf( 'forum', 'link_forum_dirname' );
$config_form->show_by_catid( 18, _AM_WEBLINKS_CONF_LINK_FORUM );

echo '<a name="form_cat_album"></a>'."\n";
echo "<h4>"._AM_WEBLINKS_CONF_CAT_ALBUM."</h4>\n";
$config_form->print_module_installed_by_conf( 'album', 'cat_album_dirname' );
$config_form->show_by_catid( 24, _AM_WEBLINKS_CONF_CAT_ALBUM );

echo '<a name="form_link_album"></a>'."\n";
echo "<h4>"._AM_WEBLINKS_CONF_LINK_ALBUM."</h4>\n";
$config_form->print_module_installed_by_conf( 'album', 'link_album_dirname' );
$config_form->show_by_catid( 25, _AM_WEBLINKS_CONF_LINK_ALBUM );

echo '<a name="form_d3forum"></a>'."\n";
echo "<h4>"._AM_WEBLINKS_CONF_D3FORUM."</h4>\n";
$config_form->print_d3forum_module_installed();
$config_form->show_by_catid( 27, _AM_WEBLINKS_CONF_D3FORUM );

echo '<a name="form_locate"></a>'."\n";
echo "<h4>"._AM_WEBLINKS_CONF_LOCATE."</h4>\n";
$config_form->show_form_country_code( _AM_WEBLINKS_CONF_LOCATE );

echo '<a name="form_map"></a>'."\n";
echo "<h4>"._AM_WEBLINKS_CONF_MAP."</h4>\n";
$config_form->show_by_catid( 20, _AM_WEBLINKS_CONF_MAP );
echo "<br />\n";

echo '<a name="form_google_seach"></a>'."\n";
echo "<h4>"._AM_WEBLINKS_CONF_GOOGLE_SEARCH."</h4>\n";
$config_form->show_by_catid( 22, _AM_WEBLINKS_CONF_GOOGLE_SEARCH );

// hack for multi site
//if ( WEBLINKS_FLAG_MULTI_SITE )
//{
//	echo '<a name="form_multi_site"></a>'."\n";
//	echo "<h4>".'multi site'."</h4>\n";
//	$config_form->show_by_catid( 23, 'multi site' );
//}

xoops_cp_footer();
exit();
// --- main end ---

?>